<?php
	include "common.php";
	session_start();
	error_reporting(0);
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$eid = $_SESSION['id'];
	$userFname = $_SESSION['userFname'];
	$userLname = $_SESSION['userLname'];
	$supervisor = $_SESSION['supervisor'];
	$role = $_SESSION['role'];
	
	$userSql = "SELECT * FROM user WHERE e_id = '$eid'";
	$userSqlQuery = mysql_query($userSql);
	$userSqlResult = mysql_fetch_assoc($userSqlQuery);
	
	$email = $userSqlResult['email'];
	$notification = $userSqlResult['notification'];
	$timezone_offset = 6; // for getting local time offset hrs
	$systemDate = gmdate('y-m-d', time()+$timezone_offset*60*60);
	$compToday = strtotime($systemDate);
	
	$sql = "SELECT * FROM user WHERE e_id = '$supervisor'";
	$sqlQuery = mysql_query($sql);
	$sqlQueryResult = mysql_fetch_assoc($sqlQuery);
	
	$supervisorName  = $sqlQueryResult['f_name']." ".$sqlQueryResult['l_name'];
	
	$delete = $_GET['delete'];
	
	$deleteSql = "UPDATE black_box_message SET status = 0 WHERE id = '$delete'";
	$deleteSqlQuery = mysql_query($deleteSql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="emp_index.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="show_report.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="curvycorners.src.js" type="text/javascript"></script>
<script src="login.js" type="text/javascript"></script>
<title><?php echo "Welcome to ".$userFname." ".$userLname; ?></title>
</head>

<body>
<div class="main_div_other">
	<p><img src="images/creato_logo.jpg" /></p>
    <p id="creatobd">www.creatobd.com</p>
    <p id="date"><script>document.write(new_month+" "+new_date+", "+old_date.getFullYear()+" || "+new_day);</script></p>
    <div class="other_page_icons">
    	<div class="new_notification">
        	<img src="images/arrow_up.JPG" /><?php if ($notification >0){?><p>You have<?php echo " ".$notification." ";?>new notification</p><?php }?>
        </div><!--end of new_notification-->
    	<ul>
        	<ul>
        	<a href="employee.php"><li><div id="home"></div><p>home</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="work_night.php"><li><div id="employee"></div><p>Work At Night</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="emp_attendance.php"><li><div id="attendance"></div><p>attendance</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="emp_leave.php"><li><div id="leave"></div><p>leave</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="notification.php"><li><div id="notification"></div><p>notification</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="emp_black_box.php"><li><div id="blackbox"></div><p>black box</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="index.php"><li><div id="logout"></div><p>log out</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
        </ul>
    </div><!-- end of other_page_icons-->
    
</div><!-- end of main_div_other-->
<div class="othrpage_1">
    <p>Menu : <a href="emp_black_box.php?check=1">Send</a> | <a href="emp_black_box.php?check=2">Check Inbox</a></p>
</div><!-- end of othrpage_1-->
<div class="human_portal">
  		<p>creato human resourse portal</p>
</div><!-- end of human_portal-->
<div class="page_content">
	<?php
		$checkSubmit = $_GET['check'];
		if ($checkSubmit == 1)
		{
	?>
		<form method="post" action="employee_blackbox.php">
			<table cellpadding="0" cellspacing="0" class="apply4leave_table">
				<td>To Whom Id</td>
					<td>
						<select name="id">
							<option value="1">Rashid Khan</option><option value="51">Alamgir Hossain</option><option value="52">Rahat Hayat</option>
							<option value="54">Bahadur Imam</option><option value="55">Jakir Hossain</option><option value="56">T.I. Shohag</option>
							<option value="57">Mahin</option><option value="58">Md. Shakil</option><option value="60">Ruhul Amin</option>
							<option value="61">Raqibul Hasan</option><option value="64">A S M Nahid</option><option value="65">Waliur Rahman</option>
							<option value="66">Atukur Rahman</option><option value="67">Nur Arefin</option><option value="68">Subarna Sharika</option>
							<option value="69">Alamin Alamin</option><option value="70">Zaiuddin Babu</option><option value="71">Md. Jashim </option>
							<option value="72">Raiana Salmin</option><option value="73">Obaidur Rahman</option><option value="74">Nafiuzzaman</option>
							<option value="75">Md. Mehrab(Trino)</option><option value="76">Mamunur Rashid</option>
							<option value="77">Zilon Zilon</option><option value="62">Priyanka 	Sarker</option>
						</select>
					</td>
				</tr>
					<tr valign="top">
					<td>Supervisor</td>
					<td><input type="text" value= "<?php echo $supervisorName; ?>" name="supervisor" readonly=""/></form></td>
				</tr>
				<tr valign="top">
					<td>Message</td>
					<td><textarea name="message" cols="18" rows="7"></textarea></td>
				</tr>
				<tr><td><input type="submit" value="submit" /></td></tr>
			</table>
		</form>	
	<?php
		}
		if ($checkSubmit ==2)
		{
	?>
		<table cellpadding="0" cellspacing="0">
			<tr class="table_header_1"  valign="top" width="300px;">
				<td colspan="3"><p>Black Box Message</p></td>		
			</tr>
			<tr valign="top" class="table_header_2">
                        <td width="60px"><p>Date</p></td>
                        <td width="60px;"><p>Message</p></td>
                        <td width="60px;"><p>Delete</p></td>
           </tr>
		   <?php
		   		$notificationSql = "SELECT * FROM black_box_message WHERE to_whom_id = '$eid' AND status =1";
				$notificationSqlQuery = mysql_query($notificationSql);
				
				while ($data = mysql_fetch_assoc($notificationSqlQuery))
				{
			?>
				<tr valign="top" class="table_header_3">
                        <td width="60px"><p><?php echo $data['Date'];?></p></td>
                        <td width="60px;"><p><?php echo $data['message'];?></p></td>
                        <td width="60px;"><p><a href="emp_black_box.php?delete=<?php echo $data['id'];?>">Delete</a></p></td>
		</table>
			<?php
				} // end of while loop
			?>
	<?php
		}  // end of if bracket
	?>
</div>
</body>
</html>